package org.yoao.crm.bean;

import java.util.Properties;

/**
 * @author yxwonline.com
 * @description
 * @date 2010-8-1 下午09:51:17
 */
public class StaticBean {

	public static final String ROLE_SYSTEM = "YOAOCRM-SYSTEM";//系统管理员

	public static final String ROLE_ADMIN = "YOAOCRM-ADMIN";//系统管理员

	public static final String ROLE_HQ = "YOAOCRM-HQ";//总公司

	public static final String ROLE_BH = "YOAOCRM-BH";//运营总监

	public static final String ROLE_YYJL = "YOAOCRM-YYJL";//运营经理

	public static final String ROLE_USER = "YOAOCRM-USER";//操作员


	public static final String CODE_HQ = "CPY-SHYOAO";//总公司代码


	public static final String JNDINAME = "jndiName";//JNDI属性名称

	public static String JNDINAME_VALUE = "jdbc/crm";//JNDI值

	public static final String PAGESIZE = "pageSize";//单页显示记录数属性名称

	public static int PAGESIZE_VALUE = 20;//单页显示记录条数

	public static final String ISSHOWOLDCUSTOMER = "isShowOldCustomer";//显示客户旧数据

	public static boolean ISSHOWOLDCUSTOMER_VALUE = false;//是否显示客户旧信息


	public static final String INITDATABASE = "DataBase";//系统配置中数据库项值



	public static final String SMSCONTENTNAME = "content";//短信KEY

	public static final String SMSSERVERADDRESS = "serverAddress";//短信服务器地址

	public static final String SMSUSER = "user";//短信服务器用户名

	public static final String SMSPASSWORD = "passWord";//短信服务器密码

	public static final String NOUPDATE_MEMO_TIME_PROP = "noupdate_memo_time";

	public static String NOUPDATE_MEMO_TIME = "2";

	public static final String SIGNATURE_YES = "1";

	public static final String SIGNATURE_NO = "0";

	public static final String LESS_AMOUNT = "1";

	public static void systemInit(){
		try {
			System.out.println("获取初始化配置文件...");
			Properties property = new Properties();
			property.load(StaticBean.class.getResourceAsStream("/resources/crm.properties"));
			String jndiName = property.getProperty(StaticBean.JNDINAME);
			String pageSize = property.getProperty(StaticBean.PAGESIZE);
			String isShowOldCustomer = property.getProperty(StaticBean.ISSHOWOLDCUSTOMER);
			NOUPDATE_MEMO_TIME = property.getProperty(StaticBean.NOUPDATE_MEMO_TIME_PROP);


			StaticBean.JNDINAME_VALUE = jndiName;

			try{
				StaticBean.PAGESIZE_VALUE = Integer.parseInt(pageSize);
			}catch(Exception e){
				e.printStackTrace();
				StaticBean.PAGESIZE_VALUE = 20;
			}

			try {
				if("1".equals(isShowOldCustomer))
					StaticBean.ISSHOWOLDCUSTOMER_VALUE = true;
				else
					StaticBean.ISSHOWOLDCUSTOMER_VALUE = false;
			} catch (Exception e) {
				e.printStackTrace();
				StaticBean.ISSHOWOLDCUSTOMER_VALUE = false;
			}
		} catch (Exception e) {
			System.out.println("系统初始化异常...");
			e.printStackTrace();
		}
	}
}